package cn.itcast.nio.c1;

import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;

import static cn.itcast.nio.c1.ByteBufferUtil.debugAll;

public class TestByteBufferString {
    public static void main(String[] args) {
        //1.
        ByteBuffer buffer1=ByteBuffer.allocate(16);
        buffer1.put("hello".getBytes());
        debugAll(buffer1);
        
        //2.
        ByteBuffer buffer2= StandardCharsets.UTF_8.encode("hello");
        debugAll(buffer2);

        //3.
        ByteBuffer buffer3=ByteBuffer.wrap("hello".getBytes());
        debugAll(buffer3);
    }
}
